import React from 'react'
import './index.less'

// function Home() {
// 	return <h1 className="home-title">Homea~</h1>
// }

class Home extends React.Component {
	
	constructor(props) {
		super(props)
		
		// 初始化状态
		this.state = {
			isHot: true,
			wind: '大风'
		}
		
		this.change = this.change.bind(this)
	}
	
	change() {
		// 注意 状态不可直接更改
		// this.state.isHot = !this.state.isHot
		this.setState({
			isHot: !this.state.isHot
		})
	}
	
	render() {
		// 读取状态
		let { isHot } = this.state
		return (
			<h1 className="home-title" onClick={this.change}>今天天气很{isHot ? '炎热' : '凉爽'}</h1>
		)
	}
	
}

export default Home
